# -*- coding: utf-8 -*-

"""
Module implementing dialog.
"""
import sys
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QMainWindow, QApplication
import re
from Ui_ui import Ui_MainWindow


class dialog(QMainWindow, Ui_MainWindow):
    """
    Class documentation goes here.
    """
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget
        @type QWidget
        """
        super(dialog, self).__init__(parent)
        self.setupUi(self)
        
        self.leIP.setInputMask('000.000.000.000;_')
        self.leMAC.setInputMask('HH:HH:HH:HH:HH:HH;#')
        self.leDate.setInputMask('000-00-00.;_')
        self.leLincese.setInputMask('>AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;#')
        self.lePhone.setInputMask('99999999999;_')
            
    @pyqtSlot()
    def on_pushButton_clicked(self):
        """
        Slot documentation goes here.
        """
        # TODO: not implemented yet
        self.leMessage.setText('')
        regex_phone='^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$'
        phone=self.lePhone.text()
        rr1=re.compile(regex_phone)
        if rr1.match(phone) is None:
            self.leMessage.setText('请输入正确的手机号码！')
        else:
            self.leMessage.setText('验证通过！')

if __name__ == "__main__":
    
    app = QApplication(sys.argv)
    dia=dialog()
    dia.show()    
    sys.exit(app.exec_())
